
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(CTPProject)

#SET(RCF_ROOT 					${CMAKE_SOURCE_DIR}/Public )
SET(BIN_PATH 					${CMAKE_SOURCE_DIR}/CTPBin)
SET(EXECUTABLE_OUTPUT_PATH 		${BIN_PATH} )
SET(LIBRARY_OUTPUT_PATH 		${BIN_PATH})
set(PRO_VECTION "Test")
LINK_DIRECTORIES( 				${BIN_PATH} )

#SET(CMAKE_INSTALL_PREFIX ${EXECUTABLE_OUTPUT_PATH})

#SET(RCF_INCLUDES ${RCF_ROOT}/rcfinclude)
Set(CTPVerLibDir ${CMAKE_CURRENT_SOURCE_DIR}/CTPLib/CTPSimNow6.6.1)
Set(TALibDir ${CMAKE_CURRENT_SOURCE_DIR}/CTPLib/talib)
IF(MSVC)
	file(COPY ${CTPVerLibDir}/win64/thosttraderapi_se.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${CTPVerLibDir}/win64/thosttraderapi_se.dll DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${CTPVerLibDir}/win64/thostmduserapi_se.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${CTPVerLibDir}/win64/thostmduserapi_se.dll DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/ta_abstract_cmr.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/ta_common_cmr.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/ta_func_cmr.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/ta_libc_cmr.lib DESTINATION ${EXECUTABLE_OUTPUT_PATH})
ELSE()
	file(COPY ${CTPVerLibDir}/linux/libthosttraderapi_se.so DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${CTPVerLibDir}/linux/libthostmduserapi_se.so DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/libta_abstract_cmr.a DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/libta_common_cmr.a DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/libta_func_cmr.a DESTINATION ${EXECUTABLE_OUTPUT_PATH})
	file(COPY ${TALibDir}/libta_libc_cmr.a DESTINATION ${EXECUTABLE_OUTPUT_PATH})
ENDIF ()

link_directories(
	${CTPVerLibDir}/linux
)


if (MSVC)
ELSE()
	set(CMAKE_PREFIX_PATH "/home/qa/Qt5.12.6/5.12.6/gcc_64")
	set(Qt5_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5")
	set(Qt5Core_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5Core")
endif ()

FIND_PACKAGE(Qt5 COMPONENTS Core REQUIRED)
IF(MSVC)
	ADD_DEFINITIONS( -D_WIN32_WINNT=0x601 -DWIN32_LEAN_AND_MEAN -D_UNICODE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
    SET(PUB_LIBS ws2_32 Qt5Core)
	IF(CMAKE_CL_64)
		SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
	ENDIF()
ELSE()
    SET(PUB_LIBS pthread dl uuid Qt5Core)	
ENDIF()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

ADD_SUBDIRECTORY(Strategy)
ADD_SUBDIRECTORY(RunPublish)
